import Mock from 'mockjs'

// 退款列表请求
Mock.mock(/\/mock\/refund.*/, 'post', (options: any) => {
  let num = 23 - (options.body - 1) * 5
  num = num > 5 ? 5 : num
  const data = Mock.mock({
    [`list|${num}`]: [{
      id: '@guid',
      'cuisine|1': ['男士餐', '女士餐', '工作餐',],
      'refund|10-100': 0,
      location: Mock.Random.county(true),
      payment: '已支付',
      'order|1': ['已完成', '进行中'],
      'name|1': [Mock.Random.cname(), Mock.Random.cname(), Mock.Random.cname(), Mock.Random.cname(), Mock.Random.cname(),],
      phone: Mock.mock(/1\d{10}/),
      orderTime: '@DATETIME("yyyy-MM-dd HH:mm:ss")',
      'refundStatus|1': ['待处理', '已退款', '已拒绝'],
      //   image: '@image(375x150,@color)',
    }],
    total: 23,
    pageSize: 5,

  })

  return {
    data,
    code: 200,
    message: '请求退款订单列表成功',
  }
})

// 退款详情请求
Mock.mock(/\/mock\/redetail.*/, 'post', () => {
  const img1 = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F62620088daaf8b47e66f8b843e7641de2a4075a43bdf3-brWb6h_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670412706&t=c6dd35c020586ae8a10fd93c0bfea3d0'
  const img2 = 'https://img1.baidu.com/it/u=1753516674,4285586002&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=849'
  const img3 = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Flmg.jj20.com%2Fup%2Fallimg%2F1114%2F121R0113012%2F20121Q13012-9-1200.jpg&refer=http%3A%2F%2Flmg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670585307&t=d058a8b02ce7c3ce24b26e1914ba4dd9'
  const img4 = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fi0.hdslb.com%2Fbfs%2Farticle%2F3fd5172834d879359818db710333c55147a5292e.jpg&refer=http%3A%2F%2Fi0.hdslb.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670585307&t=736b61565f51601fb36194952de8b4a9'
  const img5 = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2F2020-04-10%2F5e8fd7e7df2e8.jpg&refer=http%3A%2F%2Fpic1.win4000.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670585307&t=ade99c24f2faa71805d4f3a5053b180f'
  const img6 = 'https://img0.baidu.com/it/u=3875972442,3590056617&fm=253&fmt=auto&app=138&f=JPEG?w=781&h=500'
  const img7 = 'https://img2.baidu.com/it/u=1801503838,1045656518&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500'
  const img8 = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F01a0635e60b42aa80120a89552e16e.jpg%401280w_1l_2o_100sh.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670585419&t=3fc7f819d4326e623a2b9dfe164ed7fa'
  const img9 = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg3.doubanio.com%2Fview%2Fnote%2Fl%2Fpublic%2Fp72404043.jpg&refer=http%3A%2F%2Fimg3.doubanio.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670585419&t=d30a6c7f8427b4d423af5f10fbe6d92f'
  const img10 = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Flmg.jj20.com%2Fup%2Fallimg%2Ftp02%2F1Z91R13554GT-0-lp.jpg&refer=http%3A%2F%2Flmg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670585419&t=584c1a791c93f2ebe8947208310ba9f6'
  const imgaes = [img1, img2, img3, img4, img5, img6, img8, img7, img9, img10,]

  const data = Mock.mock({
    info: {
      imgs: Mock.Random.pick(imgaes, 2, 4),
      reason: '@ctitle(30,50)'
    },
    message: '请求退款订单详情成功',
  })

  return {
    data,
    code: 200,
    message: '请求退款订单详情成功',
  }
})
   
